﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class my_more_article : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        int userno = int.Parse(Request["no"]);
        int cno = int.Parse(Request["cno"]);

        ctpDataContext db = new ctpDataContext();


        var userdata = from p in db.my_citiport_mines
                       join q in db.users on p.userno equals q.no
                       join m in db.ct_profiles on p.ct_no equals m.no
                       where p.userno == userno && p.ct_no == cno
                       select new
                       {
                           ct_title = m.title.Trim(),
                           user_name = q.nickname.Trim()

                       };


        string nickname = userdata.First().user_name;

        if (nickname.Substring(nickname.Length - 1, 1) == "s")
            nickname += "'";
        else
            nickname += "'s";

        this.HyperLink3.Text = "back to " + nickname + " " + userdata.First().ct_title;
        this.HyperLink3.NavigateUrl = "default.aspx?no=" + userno.ToString() + "&cno=" + cno.ToString();

        var data = from p in db.ct_s_intros
                   join q in db.ct_s_profiles on p.ct_s_no equals q.no
                   where p.create_user_no == userno && q.valid == true && p.ct_no == cno
                   select new
                   {
                       intro = p.intro,
                       title = q.title,
                       img = q.main_pic_fn.Trim(),
                       no = q.no
                   };

        this.GridView1.DataSource = data.ToList();
        this.DataBind();
    }
}
